#ifndef TYPES_EXTENDED
#define TYPES_EXTENDED

#include "Bmp24LineReader.h"

/*oOoOoOoOoOoOoOoOoOoOoOoOooOoOoOoOoOoO*/
//		Extended Types Module
/*oOoOoOoOoOoOoOoOoOoOoOoOooOoOoOoOoOoO*/
// This module is a complement to the "types" module. It adds various types which are used throughout 
// the project: 
//		- TArea - A struct that contains all the information we need to know about an area of the picture.
//		- TBoxSize - A struct that defines the height and width of a box, possibly containing a face.
//		- TBox - A struct that defines a box - it's size and origin.
//		- TFace - A struct implementing an element in a linked list (the facebook) that represents a face. 
//					Each face that is found in the picture will be added to the facebook as such an element.
//		- TImageReaderAndProperties - A struct that holds together the image reader and all the usefull properties of 
//										the image: Pitch, Width, Height and Padding.
//		- TError - An enum that helps handling errors. It contains all the types of errors handled in this program.

// an area struct contains the limits for each face search when dividing the image
typedef struct {
	int HorizontalIndex; 
	int VerticalIndex;
	int OriginX;
	int OriginY;
	int Width;
	int Height;
} TArea;

// general information for boxes
typedef struct {
	int Width;
	int Height;
} TBoxSize;

// a box of pixels knowing its origin width and height
typedef struct {
	TBoxSize BoxSize;
	int OriginX;
	int OriginY;
} TBox;


// a face is a box the a face was found in and a pointer to the next face
//(part of a linked list)
typedef struct _TFace
{
	TBox Box;
	struct _TFace *NextFace; 
} TFace;


// Genenral information about the image
typedef struct 
{
	Bmp24LineReader Reader;
	int Pitch;
	int Width;
	int Height;
	int Padding;
} TImageReaderAndProperties;

// arguments needed for propere use of the area thread
typedef struct
{
	HANDLE event_finish;
	HANDLE mutex_faces;
	TFace *FaceHead;//start of linked list
	TArea AreaValue;
}TAreaThreadArgs;


// arguments needed for propere use of the area thread
typedef struct
{
	int OriginX;
	int OriginY;
} TFoundeFaceThreadArgs;

// diffrent error values to use for error output print.
typedef enum {
	ERROR_ALLOCATING_MEMORY, 
	ERROR_CREATING_MUTEX, 
	ERROR_CREATING_THREAD, 
	ERROR_CREATING_SEMAPHORE, 
	ERROR_CREATING_EVENT,
	ERROR_RELEASING_SEMAPHORE, 
	ERROR_RELEASING_MUTEX, 
	ERROR_SETTING_EVENT,
	ERROR_WAITING_FOR_SINGLE_OBJECT, 
	ERROR_WAITING_FOR_MULTIPLE_OBJECT, 
	ERROR_READING_ROW,
	ERROR_INITIALIZING_READER,
	ERROR_ADDING_FACE_TO_FACEBOOK,
	ERROR_WRITING_TO_FILE,
	ERROR_GETTING_IMAGE_PROPERTIES,
	GENERAL_ERROR
} TError;
#endif
